package com.xja.seckill.users.controller;

import com.xja.seckill.order.commons.JsonBean;
import com.xja.seckill.users.domain.model.Users;
import com.xja.seckill.users.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;

@RestController
public class UsersController {

    @Autowired
    private UsersService userssService;

    @RequestMapping("login")
    public JsonBean login(String username ,String password,HttpServletRequest request) {
        return userssService.login(username, password,request);
    }

    @RequestMapping("registered")
    public JsonBean registered(Users users) {
        return userssService.registered(users);
    }

    @PostMapping("test")
    public JsonBean test(String test , HttpServletRequest request){
        String requestURI = request.getParameter ("test");
        return new JsonBean(0,"",requestURI);

    }
}
